<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <style>
        .aui-pull-right {
            color: #363436 !important;
            font-size: 0.8rem;
        }
        
        #footer {
            background-color: #FFF;
            height: 2.5rem;
        }
        
        .recommend {
            width: 3rem;
            text-align: center;
        }
        
        .recommend .ico {
            height: 1.2rem;
            background-position: center top;
            background-repeat: no-repeat;
            background-size: auto 100%;
            background-image: url(../../image/mine/guc001.png);
        }
        
        .recommend .ico2 {
            height: 1.2rem;
            background-position: center top;
            background-repeat: no-repeat;
            background-size: auto 100%;
            background-image: url(../../image/mine/kf001.png);
        }
        
        .recommend .txt {
            margin-top: 0.15rem;
            font-size: 0.6rem;
            line-height: 1;
            color: #333;
        }
        
        .recommend .txt:after {
            content: "购物车";
        }
        
        .recommend .txt2 {
            margin-top: 0.15rem;
            font-size: 0.6rem;
            line-height: 1;
            color: #333;
        }
        
        .recommend .txt2:after {
            content: "客服";
        }
        
        .btmShareBox {
            padding: 0 0.75rem 0 0rem;
        }
        
        .btmShareBox>div {
            width: 50%;
            height: 2rem;
            font-size: 0.7rem;
        }
        
        .btmShareBox .left {
            border-radius: 0.4rem 0 0 0.4rem;
            border: 1px solid #E73250;
            border-right: none;
            color: #E73250;
        }
        
        .btmShareBox .right {
            border-radius: 0 0.4rem 0.4rem 0;
            color: #FFF;
            background-image: linear-gradient(-5deg, #E73451 1%, rgba(231, 50, 80, 0.66) 100%);
        }
        
        .btmShareBox img {
            margin-right: 0.25rem;
            height: 0.8rem;
            width: auto;
        }
        
        @media all and (max-width: 360px) {
            .btmShareBox>div {
                font-size: 0.6rem;
            }
            .btmShareBox img {
                margin-right: 0.15rem;
                height: 0.75rem;
            }
        }
        
        .addbtn {
            text-align: center;
            background-color: #E73450;
            height: 2.5rem;
            line-height: 2.5rem;
            color: #FFFFFF;
        }
        
        .sharebtn {
            text-align: center;
            background-color: #FA7D83;
            height: 2.5rem;
            line-height: 2.5rem;
            color: #FFFFFF;
        }
        
        .aui-badge {
            left: 2rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav aui-bar-light" id="header">
        <div class="aui-pull-left back" tapmode onclick="api.closeWin()"></div>
        <div class="aui-title">自营商品</div>
    </header>

    <div class="btmFix aui-flex-col aui-flex-middle aui-flex-between aui-border-t" id="footer">
        <div class="recommend" tapmode onClick="openCart();">
            <div class="ico"></div>
            <div class="txt"></div>
            <div class="aui-badge aui-hide cartBadge"></div>
        </div>
        <div class="recommend" tapmode onClick="contact()">
            <div class="ico2"></div>
            <div class="txt2"></div>
        </div>
        <div class="flex-auto addbtn" tapmode onclick="openShare()">
            分享给好友
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/import.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
    var userInfo;
    var shareUrl;
    apiready = function() {
        api.parseTapmode();
        var header = $api.byId('header');
        $api.fixStatusBar(header);
        var headerH = $api.offset(header).h;
        var footerH = $api.offset($api.byId('footer')).h;

        userInfo = getUserinfo();
        shareUrl = 'http://taoke.maiyatang.info/Wx/Mall/index/sourceSpread/'+userInfo.user_invitation_code;
        
        api.openFrame({
            name: 'gift_list_frm',
            url: 'gift_list_frm.html',
            rect: {
                x: 0,
                y: headerH,
                w: 'auto',
                h: 'auto',
                marginBottom: footerH
            },
            useWKWebView: true,
            pageParam: {
                godType: 'self'
            }
        });
        cartDot();
        api.addEventListener({
            name: 'cartUpdateEvent'
        }, function(ret, err){
            cartDot();
        });
    };

    function contact() {
        api.openFrame({
            name: 'contactKeFu',
            url: 'contactKeFu.html',
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: 'auto',
            },
            bounces: false,
            animation: {
                type: 'fade',
                duration: 300
            }
        });
    }

    function openShare() {
        api.openFrame({
            name: 'share_btm_mask',
            url: 'widget://html/share_btm_mask.html',
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: 'auto'
            },
            bounces: false,
            animation: {
                type: 'fade',
                duration: 300
            },
            pageParam: {
                wname: api.winName,
                fname: api.frameName
            }
        });
    }

   
   function share(type){
        var shareUrl = 'http://taoke.maiyatang.info/wx/wxhtml/giftBag/gift_list.html?type=2';
        var wx = api.require('wx');
        wx.shareWebpage({
            apiKey: '',
            scene: type,
            title: '自营商品',
            description: '',
            thumb: 'widget://image/common/applogo.png',
            contentUrl: shareUrl
        }, function(ret, err) {
            if (ret.status){
                toast('分享成功');
            } else {
                toast('分享失败');
            }
        });
    }
    
</script>

</html>